from typing import List
class Solution:
     def maxProfit(self, prices: List[int]) -> int:
        mincote = float('inf')
        maxprofit = 0
        for price in prices:
            mincote = min(mincote, price)
            maxprofit = max(maxprofit, price - mincote)
        return maxprofit


prices=[7,1,5,3,6,4]
s=Solution()
print(s.maxProfit(prices))